
package com.shop.cloud.live.admin.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.cloud.common.core.constant.CacheConstants;
import com.shop.cloud.live.common.entity.LiveConfig;
import com.shop.cloud.live.admin.mapper.LiveConfigMapper;
import com.shop.cloud.live.admin.service.LiveConfigService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.io.Serializable;

/**
 * 直播配置
 *
 * @author
 * @date 2025-01-09 10:03:39
 */
@Service
public class LiveConfigServiceImpl extends ServiceImpl<LiveConfigMapper, LiveConfig> implements LiveConfigService {

    @Override
    @CacheEvict(value = CacheConstants.LIVE_LIVE_CONFIG, key = "'value'")
    public boolean updateById(LiveConfig entity) {
        return super.updateById(entity);
    }

    @Override
    @CacheEvict(value = CacheConstants.LIVE_LIVE_CONFIG, key = "'value'")
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

    @Override
    @CacheEvict(value = CacheConstants.LIVE_LIVE_CONFIG, key = "'value'")
    public boolean save(LiveConfig entity) {
        return super.save(entity);
    }

    @Override
    @Cacheable(value = CacheConstants.LIVE_LIVE_CONFIG, key = "'value'")
    public LiveConfig getByTenantId(Serializable tenantId) {
        return baseMapper.selectOne(Wrappers.emptyWrapper());
    }
}
